//
//  WBPopButton.swift
//  SainMicroblog
//
//  Created by chenxinju on 16/5/10.
//  Copyright © 2016年 chenxinju-a2. All rights reserved.
//

import UIKit

class WBPopButton: UIButton {
    
    override  init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    

    func setupUI() {
        setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
       titleLabel?.font = UIFont.systemFontOfSize(16)
        titleLabel?.tintColor = UIColor.darkGrayColor()
        titleLabel?.textAlignment = .Center
        imageView?.contentMode = .Center
        
    }
       //MARK:- 自定义布局
    override func layoutSubviews() {
        super.layoutSubviews()

        imageView?.frame.size = CGSizeMake(self.frame.width, self.frame.height - 30)
        imageView?.frame.origin.x = 0
        imageView?.frame.origin.y = 0
        
        titleLabel?.frame.size = CGSizeMake(self.frame.width, self.frame.height - self.frame.width)
        titleLabel?.frame.origin.x = 0
        titleLabel?.frame.origin.y = self.frame.width

    }
}
